home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / geowindo / samplece.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-05-28  |  4.7 KB  |  170 lines

  1. // SampleCE.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "SampleCE.h"
  6.  
  7. #include "MainFrm.h"
  8. #include "SampleCEDoc.h"
  9. #include "SampleCEView.h"
  10.  
  11. #include "GeometryManager.h"
  12.  
  13. #ifdef _DEBUG
  14. #define new DEBUG_NEW
  15. #undef THIS_FILE
  16. static char THIS_FILE[] = __FILE__;
  17. #endif
  18.  
  19. /////////////////////////////////////////////////////////////////////////////
  20. // CSampleCEApp
  21.  
  22. BEGIN_MESSAGE_MAP(CSampleCEApp, CWinApp)
  23.     //{{AFX_MSG_MAP(CSampleCEApp)
  24.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  25.         // NOTE - the ClassWizard will add and remove mapping macros here.
  26.         //    DO NOT EDIT what you see in these blocks of generated code!
  27.     //}}AFX_MSG_MAP
  28.     // Standard file based document commands
  29.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  30.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  31. END_MESSAGE_MAP()
  32.  
  33. /////////////////////////////////////////////////////////////////////////////
  34. // CSampleCEApp construction
  35.  
  36. CSampleCEApp::CSampleCEApp(LPCTSTR lpszAppName)
  37.     : CWinApp(lpszAppName)
  38. {
  39.     // TODO: add construction code here,
  40.     // Place all significant initialization in InitInstance
  41. }
  42.  
  43. /////////////////////////////////////////////////////////////////////////////
  44. // The one and only CSampleCEApp object
  45.  
  46. // WCE MFC apps require the application name to be specified in the CWinApp 
  47. // constructor. A help contents filename may also be specified.
  48.  
  49. CSampleCEApp theApp(_T("SampleCE"));
  50.  
  51. /////////////////////////////////////////////////////////////////////////////
  52. // CSampleCEApp initialization
  53.  
  54. BOOL CSampleCEApp::InitInstance()
  55. {
  56.     // Standard initialization
  57.     // If you are not using these features and wish to reduce the size
  58.     //  of your final executable, you should remove from the following
  59.     //  the specific initialization routines you do not need.
  60.  
  61.     // Change the registry key under which our settings are stored.
  62.     // You should modify this string to be something appropriate
  63.     // such as the name of your company or organization.
  64.     SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  65.  
  66.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  67.  
  68.     // register this instance of GeometryManager
  69.     //
  70.     // When you purchase a license of GeometryManager, you
  71.     // will enter the registration code string here and
  72.     // the DLL will no longer remind you to register!
  73.     //
  74.     // NOTE: This is a char array, not a UNICODE array!
  75.     //
  76.     VERIFY(GmRegister("ENTER YOUR REGISTRATION CODE HERE"));
  77.  
  78.     // Register the application's document templates.  Document templates
  79.     //  serve as the connection between documents, frame windows and views.
  80.  
  81.     CSingleDocTemplate* pDocTemplate;
  82.     pDocTemplate = new CSingleDocTemplate(
  83.         IDR_MAINFRAME,
  84.         RUNTIME_CLASS(CSampleCEDoc),
  85.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  86.         RUNTIME_CLASS(CSampleCEView));
  87.     AddDocTemplate(pDocTemplate);
  88.  
  89.     // Parse command line for standard shell commands, DDE, file open
  90.     CCommandLineInfo cmdInfo;
  91.     ParseCommandLine(cmdInfo);
  92.  
  93.     // Dispatch commands specified on the command line
  94.     if (!ProcessShellCommand(cmdInfo))
  95.         return FALSE;
  96.  
  97.     // The one and only window has been initialized, so show and update it.
  98.     m_pMainWnd->ShowWindow(SW_SHOW);
  99.     m_pMainWnd->UpdateWindow();
  100.  
  101.     return TRUE;
  102. }
  103.  
  104. /////////////////////////////////////////////////////////////////////////////
  105. // CAboutDlg dialog used for App About
  106.  
  107. class CAboutDlg : public CDialog
  108. {
  109. public:
  110.     CAboutDlg();
  111.  
  112. // Dialog Data
  113.     //{{AFX_DATA(CAboutDlg)
  114.     enum { IDD = IDD_ABOUTBOX };
  115.     //}}AFX_DATA
  116.  
  117.     // ClassWizard generated virtual function overrides
  118.     //{{AFX_VIRTUAL(CAboutDlg)
  119.     protected:
  120.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  121.     //}}AFX_VIRTUAL
  122.  
  123. // Implementation
  124. protected:
  125.     //{{AFX_MSG(CAboutDlg)
  126.     virtual BOOL OnInitDialog();        // Added for WCE apps
  127.     //}}AFX_MSG
  128.     DECLARE_MESSAGE_MAP()
  129. };
  130.  
  131. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  132. {
  133.     //{{AFX_DATA_INIT(CAboutDlg)
  134.     //}}AFX_DATA_INIT
  135. }
  136.  
  137. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  138. {
  139.     CDialog::DoDataExchange(pDX);
  140.     //{{AFX_DATA_MAP(CAboutDlg)
  141.     //}}AFX_DATA_MAP
  142. }
  143.  
  144. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  145.     //{{AFX_MSG_MAP(CAboutDlg)
  146.         // No message handlers
  147.     //}}AFX_MSG_MAP
  148. END_MESSAGE_MAP()
  149.  
  150. // App command to run the dialog
  151. void CSampleCEApp::OnAppAbout()
  152. {
  153.     CAboutDlg aboutDlg;
  154.     aboutDlg.DoModal();
  155. }
  156.  
  157. /////////////////////////////////////////////////////////////////////////////
  158. // CSampleCEApp commands
  159. // Added for WCE apps
  160.  
  161. BOOL CAboutDlg::OnInitDialog() 
  162. {
  163.     CDialog::OnInitDialog();
  164.     
  165.     CenterWindow();
  166.     
  167.     return TRUE;  // return TRUE unless you set the focus to a control
  168.                   // EXCEPTION: OCX Property Pages should return FALSE
  169. }
  170.